<template>
	 <img class="code-img" :src="src"  @click="getImg()"></img>
</template>

<script> 
	 export default {
	 	props: { 
	 		type: String, 
	 	}, 
		data(){
			 return {
				 src:null,
			 }
		}, 
		mounted() {
			  this.getImg() 
			 	  
		},
	 	methods: {
			async getImg(){
				var url = this.type == 'login' ? "/getLoginImageCode":"/imageCaptchaImage";
				var data = await this.get(url)
				this.src = "data:image/gif;base64," + data.img;
				this.$store.state.uuid =  data.uuid;
			},
	 		 
	 	}
	 }
</script>

<style > 
	.code-img{
		height:30px;
		width: 100px;
	} 
</style>
